﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace MTS
{
    class BlockColors
    {
        private Color[] blockColors;
        private Color defaultColor;

        public BlockColors()
        {
            this.blockColors = new Color[83];
            this.defaultColor = Color.FromArgb(255, 255, 0, 255);

            this.blockColors[1] = Color.FromArgb(255, 120, 120, 120);
            this.blockColors[2] = Color.FromArgb(255, 117, 176, 73);
            this.blockColors[3] = Color.FromArgb(255, 134, 96, 67);
            this.blockColors[4] = Color.FromArgb(255, 115, 115, 115);
            this.blockColors[48] = Color.FromArgb(255, 115, 115, 115);
            this.blockColors[5] = Color.FromArgb(255, 157, 128, 79);
            this.blockColors[6] = Color.FromArgb(0, 120, 120, 120);
            this.blockColors[7] = Color.FromArgb(255, 84, 84, 84);
            this.blockColors[8] = Color.FromArgb(51, 38, 92, 255);
            this.blockColors[9] = Color.FromArgb(51, 38, 92, 255);
            this.blockColors[10] = Color.FromArgb(255, 255, 90, 0);
            this.blockColors[11] = Color.FromArgb(255, 255, 90, 0);
            this.blockColors[12] = Color.FromArgb(255, 218, 210, 158);
            this.blockColors[13] = Color.FromArgb(255, 136, 126, 126);
            this.blockColors[14] = Color.FromArgb(255, 143, 140, 125);
            this.blockColors[15] = Color.FromArgb(255, 136, 130, 127);
            this.blockColors[16] = Color.FromArgb(255, 115, 115, 115);
            this.blockColors[17] = Color.FromArgb(255, 102, 81, 51);
            this.blockColors[18] = Color.FromArgb(100, 60, 192, 41);
            this.blockColors[20] = Color.FromArgb(64, 255, 255, 255); //glass
            //this.blockColors[21] = Color.FromArgb(222,50,50,255);
            //this.blockColors[22] = Color.FromArgb(222,136,50,255);
            //this.blockColors[23] = Color.FromArgb(222,222,50,255);
            //this.blockColors[24] = Color.FromArgb(136,222,50,255);
            //this.blockColors[25] = Color.FromArgb(50,222,50,255);
            //this.blockColors[26] = Color.FromArgb(50,222,136,255);
            //this.blockColors[27] = Color.FromArgb(50,222,222,255);
            //this.blockColors[28] = Color.FromArgb(104,163,222,255);
            //this.blockColors[29] = Color.FromArgb(120,120,222,255);
            //this.blockColors[30] = Color.FromArgb(136,50,222,255);
            //this.blockColors[31] = Color.FromArgb(174,74,222,255);
            //this.blockColors[32] = Color.FromArgb(222,50,222,255);
            //this.blockColors[33] = Color.FromArgb(222,50,136,255);
            //this.blockColors[34] = Color.FromArgb(77,77,77,255);
            this.blockColors[35] = Color.FromArgb(255, 222, 222, 222); //Color.FromArgb(143,143,143,255);
            //this.blockColors[36] = Color.FromArgb(222,222,222,255);
            this.blockColors[41] = Color.FromArgb(255, 232, 245, 46);
            this.blockColors[42] = Color.FromArgb(255, 191, 191, 191);
            this.blockColors[43] = Color.FromArgb(255, 200, 200, 200);
            this.blockColors[44] = Color.FromArgb(255, 200, 200, 200);
            this.blockColors[45] = Color.FromArgb(255, 170, 86, 62);
            this.blockColors[49] = Color.FromArgb(255, 26, 11, 43);
            this.blockColors[50] = Color.FromArgb(200, 245, 220, 50);
            this.blockColors[51] = Color.FromArgb(200, 255, 170, 30);
            //this.blockColors[52] = Color.FromArgb(245,220,50,255); unnecessary afaik
            this.blockColors[53] = Color.FromArgb(255, 157, 128, 79);
            this.blockColors[54] = Color.FromArgb(255, 125, 91, 38);
            //this.blockColors[55] = Color.FromArgb(245,220,50,255); unnecessary afaik
            this.blockColors[56] = Color.FromArgb(255, 129, 140, 143);
            this.blockColors[57] = Color.FromArgb(255, 45, 166, 152);
            this.blockColors[58] = Color.FromArgb(255, 114, 88, 56);
            this.blockColors[59] = Color.FromArgb(255, 146, 192, 0);
            this.blockColors[60] = Color.FromArgb(255, 95, 58, 30);
            this.blockColors[61] = Color.FromArgb(255, 96, 96, 96);
            this.blockColors[62] = Color.FromArgb(255, 96, 96, 96);
            this.blockColors[63] = Color.FromArgb(255, 111, 91, 54);
            this.blockColors[64] = Color.FromArgb(255, 136, 109, 67);
            this.blockColors[65] = Color.FromArgb(32, 181, 140, 64);
            this.blockColors[66] = Color.FromArgb(180, 150, 134, 102);
            this.blockColors[67] = Color.FromArgb(255, 115, 115, 115);
            this.blockColors[71] = Color.FromArgb(255, 191, 191, 191);
            this.blockColors[73] = Color.FromArgb(255, 131, 107, 107);
            this.blockColors[74] = Color.FromArgb(255, 131, 107, 107);
            this.blockColors[75] = Color.FromArgb(32, 181, 140, 64);
            this.blockColors[76] = Color.FromArgb(200, 255, 0, 0);
            this.blockColors[78] = Color.FromArgb(255, 255, 255, 255);
            this.blockColors[79] = Color.FromArgb(51, 83, 113, 163);
            this.blockColors[80] = Color.FromArgb(255, 250, 250, 250);
            this.blockColors[81] = Color.FromArgb(255, 25, 120, 25);
            this.blockColors[82] = Color.FromArgb(255, 217, 217, 217); // clay
        }

        public Color getBlockColor(byte tile)
        {
            if (tile > this.blockColors.Length - 1)
            {
                // No tile
                return this.defaultColor;
            }
            else if (tile < 0)
            {
                return this.defaultColor;
            }
            else
            {
                return this.blockColors[tile];
            }
        }
    }
}
